//package com.zmn.plat.dubbo.impl.product;
//
//import java.util.List;
//import java.util.Objects;
//import java.util.stream.Collectors;
//
//import javax.annotation.Resource;
//
//import org.apache.dubbo.config.annotation.Service;
//import org.springframework.cglib.beans.BeanCopier;
//import org.springframework.util.CollectionUtils;
//
//import com.zmn.common.dto2.ResponseDTO;
//import com.zmn.common.utils.number.NumberUtil;
//import com.zmn.manager.common.database.annotation.ReadOnlyConnection;
//import com.zmn.plat.common.dictionary.PlatErrorCodeDict;
//import com.zmn.plat.common.dto.product.picture.ServProductPictureDRO;
//import com.zmn.plat.common.exception.PlatException;
//import com.zmn.plat.dubbo.interfaces.product.ServProductPictureListRemoteService;
//import com.zmn.plat.dubbo.utils.DubboConsts;
//import com.zmn.plat.model.entity.product.ServProductPicture;
//import com.zmn.plat.services.interfaces.product.ServProductPictureService;
//import com.zmn.plat.utils.bean.BeanCopyUtils;
//
//import lombok.extern.slf4j.Slf4j;
//
///**
// * @author tanghongjun
// * @version v1.0 @类说明：
// * @since 2018/10/16 11:30
// */
//@Service(version = DubboConsts.INTERFACE_VERSION, validation = "true")
//@Slf4j
//public class ServProductPictureListRemoteServiceImpl implements ServProductPictureListRemoteService {
//
//    @Resource
//    private ServProductPictureService servProductPictureService;
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<ServProductPictureDRO> getServProductPictureByProductId(Integer productId) {
//        log.info("getServProductPictureByProductId 参数为：productId={}", productId);
//        if (NumberUtil.isNullOrZero(productId)) {
//            log.error("产品id为空,errorCode:{}", PlatErrorCodeDict.ERROR_CODE_PANAM_NULL);
//            return ResponseDTO.fromErrorCodeTable(PlatErrorCodeDict.ERROR_CODE_PANAM_NULL);
//        }
//        ServProductPicture servProductPicture = servProductPictureService.findByProductId(productId);
//        if (Objects.isNull(servProductPicture)) {
//            log.error("当前产品没有配置图片.productId:{},errorCode:{}", productId, PlatErrorCodeDict.ERROR_CODE_PRODUCT_PICTURE_NO_DATA);
//            return ResponseDTO.fromErrorCodeTable(PlatErrorCodeDict.ERROR_CODE_PRODUCT_PICTURE_NO_DATA);
//        }
//        ServProductPictureDRO servProductPictureDRO = new ServProductPictureDRO();
//        BeanCopyUtils.copyProperties(servProductPicture, servProductPictureDRO);
//        return ResponseDTO.success(servProductPictureDRO);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<ServProductPictureDRO>> listServProductPictureByProductIds(List<Integer> productIdList) {
//        log.info("listServProductPictureByProductIds param is:productIdList={}", productIdList);
//
//        if (CollectionUtils.isEmpty(productIdList)) {
//            log.error("产品ID不能为空");
//            return ResponseDTO.fromErrorCodeTable(PlatErrorCodeDict.ERROR_CODE_PANAM_NULL);
//        }
//
//        List<ServProductPicture> productPictureList = servProductPictureService.listByProductIds(productIdList);
//        BeanCopier copier = BeanCopier.create(ServProductPicture.class, ServProductPictureDRO.class, false);
//        List<ServProductPictureDRO> dros = productPictureList.stream().map(servProductPicture -> {
//            ServProductPictureDRO servProductPictureDRO = new ServProductPictureDRO();
//            copier.copy(servProductPicture, servProductPictureDRO, null);
//            return servProductPictureDRO;
//        }).collect(Collectors.toList());
//
//        return ResponseDTO.success(dros);
//    }
//}
